﻿<%@ Page Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="MyRecipes.aspx.cs" Inherits="RecipeBookWeb.MyRecipes" Title="My Recipes" %>
<asp:Content ID="MyRecipesViewContent" ContentPlaceHolderID="MainContent" Runat="Server">
    <asp:Label runat="server" ID="WelcomeLabel" />
    <br /><br />
    <asp:HyperLink runat="server" Text="Add Recipe" NavigateUrl="~/AddRecipe.aspx" />
    <br /><br />
    Favorite Recipes:<br />
    <asp:GridView runat="server" ID="FavoriteGridView" AutoGenerateColumns="false" Width="98%" GridLines="Horizontal">
        <Columns>
	        <asp:TemplateField HeaderText="Recipe Name" ItemStyle-Width="40%">
	            <ItemTemplate>
	                <asp:HyperLink ID="HyperLink1" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Name") %>' NavigateUrl='<%# "ViewRecipe.aspx?RecipeID=" + DataBinder.Eval(Container.DataItem, "ID").ToString() %>' />
	            </ItemTemplate>
	        </asp:TemplateField>
	        <asp:TemplateField HeaderText="Date Added" ItemStyle-Width="15%">
	            <ItemTemplate>
	                <%# ((DateTime)DataBinder.Eval(Container.DataItem, "DateAdded")).ToShortDateString() %>
	            </ItemTemplate>
	        </asp:TemplateField>
	        <asp:TemplateField HeaderText="Rating" ItemStyle-Width="10%">
	            <ItemTemplate>
	                <%# DataBinder.Eval(Container.DataItem, "CompositeRating").ToString() %> / 7
	            </ItemTemplate>
	        </asp:TemplateField>
        </Columns>
    </asp:GridView>
    <br />
    Owned Recipes:<br />
    <asp:GridView runat="server" ID="AddedRecipeGridView" AutoGenerateColumns="false" Width="98%" GridLines="Horizontal">
        <Columns>
	        <asp:TemplateField HeaderText="Recipe Name" ItemStyle-Width="40%">
	            <ItemTemplate>
	                <asp:HyperLink ID="HyperLink1" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Name") %>' NavigateUrl='<%# "ViewRecipe.aspx?RecipeID=" + DataBinder.Eval(Container.DataItem, "ID").ToString() %>' />
	            </ItemTemplate>
	        </asp:TemplateField>
	        <asp:TemplateField HeaderText="Date Added" ItemStyle-Width="15%">
	            <ItemTemplate>
	                <%# ((DateTime)DataBinder.Eval(Container.DataItem, "DateAdded")).ToShortDateString() %>
	            </ItemTemplate>
	        </asp:TemplateField>
	        <asp:TemplateField ItemStyle-Width="10%">
	            <ItemTemplate>
	                <asp:LinkButton runat="server" Text="Edit" />
	            </ItemTemplate>
	        </asp:TemplateField>
        </Columns>
    </asp:GridView>    
</asp:Content>